Bugfix: Task notification plugin fails to send email notifications in production mode #1346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses an issue with the task notification plugin that prevented it from sending email notifications as expected in production mode. Specifically, the plugin was able to send notifications when using the Send test email button on the configuration form of the webapp, but failed to do so when triggered via a signal on a processing node. Although not entirely certain, this behavior may be traced to the plugin's inability to read/write the .conf file when running on processing node instances.
Solution
To fix the issue, this PR refactors the plugin to use the plugin DataStore instead of the .conf file. This approach ensures that the plugin's configuration is accessible across all instances, allowing it to send email notifications as expected in both dev and production mode.
Changes
In terms of changes made, the load() and save() functions have been refactored to use the plugin DataStore to retrieve and save the configuration, respectively. This eliminates the need for the .conf file and ensures that the plugin works correctly
Tests
To confirm the fix, I tested the plugin locally in both dev and production environments and verified that email notifications are sent when tasks finish processing and when tasks fail during processing.